<%@include file="taglibs/taglibs.jsp"%>
<html>
<head>
	<%@include file="pieces/header.jsp"%>
	<meta name="description" content="Hello File">
</head>
<body>
<li><a href="/index">home</a></li>
<div class="container">
	<h1 class="alert-info">clients</h1>
  <jsp:include page="pieces/mainMenue.jsp" />
  <form:form action="clients" modelAttribute="clientForm"  acceptCharset="utf-8">
 <table border="2">
   <tr>
     <td>id</td>
     <td>name</td>
     <td>transactions</td>
   </tr>
  <c:forEach var="client" items="${clients}">
        <tr>
          <spring:url value="/clients/{clientId}" var="clientIdUrl">
            <spring:param name="clientId" value="${client.id}"/>
          </spring:url>
          <spring:url value="/transactions/byClient/{clientId}" var="clientIdTransactionsUrl">
            <spring:param name="clientId" value="${client.id}"/>
          </spring:url>
          <td><c:out value="${client.id}"/></td>
          <td><a href="${clientIdUrl}"><c:out value="${client.name}"/></a></td>
          <td><a href="${clientIdTransactionsUrl}"><c:out value="transactions"/></a></td>
        </tr>
 </c:forEach>
   <tr>
     <td><form:input path="id" /><form:errors path="id" cssClass="alert-danger" /></td>
     <td><form:input path="name" /><form:errors path="name" cssClass="alert-danger" /></td>
     <td><input type="submit" value="add"/></td>
   </tr>
 </table>
      <div class="alert-warning"><form:errors/></div>
  </form:form>
  <a href="<spring:url value="/clients/rest.xml"/>">xml</a>
  <a href="<spring:url value="/clients/rest.json"/>">json</a>

</div>
</body>
</html>
